{
  LW Camera -- LightWave Camera Handlers

  Based on lwcamera.h which is:
  Copyright 1999, NewTek, Inc.
}

{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}

unit LW_Camera;

{$mode objfpc}{$H+}

interface

uses
  LW_Types  ,
  LW_Render ,
  LW_Handler;

const
  LWCAMERA_HCLASS  = 'CameraHandler'  ;
  LWCAMERA_ICLASS  = 'CameraInterface';
  LWCAMERA_GCLASS  = 'CameraGizmo'    ;
  LWCAMERA_VERSION = 2                ;

  { Camera handler evaluation return values }
  LWCAMTYPEEVAL_NO_RAY        = 0;
  LWCAMTYPEEVAL_RAY           = 1;
  LWCAMTYPEEVAL_DO_DEF_INTERP = 3;

  { Camera handler flags }
  LWCAMTYPEF_SUPPORTSDOF      = 1 shl 0;
  LWCAMTYPEF_SUPPORTSSTEREO   = 1 shl 1;

type
  PLWCameraAccess = ^TLWCameraAccess;
  TLWCameraAccess = record
    CameraID    : PLWItem                  ;
    WorldPos    : TLWDVector               ;
    ToWorld     : Array[0..3] of TLWDVector;
    ToCamera    : Array[0..3] of TLWDVector;
    FilmSize    : Array[0..2] of Double    ;
  end;

  PLWCameraHandler = ^TLWCameraHandler;
  TLWCameraHandler = record
    Inst     : PLWInstanceFuncs;
    Item     : PLWItemFuncs    ;
    Rend     : PLWRenderFuncs  ;
    Preview  : function
               (      Instance    : PLWInstance       ;
                      LPX, LPY    : Double            ;
                      Projection  : TLWDMatrix4       ;
                const CamAccess   : PLWCameraAccess   )  : Integer;
    NewFrame : function
               (const FrameInfo   : PLWFrameInfo      ;
                const CamAccess   : PLWCameraAccess   )  : PLWError;
    Evaluate : function
               (      FPX         ,
                      FPY         ,
                      LPX         ,
                      LPY         ,
                      FracTime    : Double            ;
                      Ray         : PLWCameraRay      ;
                const CamAccess   : PLWCameraAccess   )  : Integer;
    Flags    : function
               (      Instance    : PLWInstance       )  : UInt32 ;
  end;

implementation

end.

